package com.java.controller;


import com.java.config.result.Result;
import com.java.model.hosp.Schedule;
import com.java.service.ScheduleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(tags = "科室")
@RestController
@RequestMapping("/admin/hosp/schedule")
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    /**
     * 查询科室规则分页
     * @param pageNum
     * @param pageSize
     * @param hoscode
     * @param depcode
     * @return
     */
    @ApiOperation("查询科室规则分页")
    @GetMapping("/getSchedule/{pageNum}/{pageSize}/{hoscode}/{depcode}")
    public Map<String, Object> getSchedule(@PathVariable("pageNum") Integer pageNum,
                                           @PathVariable("pageSize") Integer pageSize,
                                           @PathVariable("hoscode") String hoscode,
                                           @PathVariable("depcode") String depcode
                              ){

        Map<String, Object> shoduleMap = scheduleService.getShoduleMap(pageNum, pageSize, hoscode, depcode);

        return shoduleMap;
    }

    /**
     * 根据hoscode depcode workDate查询科室详情
     * @param hoscode
     * @param depcode
     * @param workDate
     * @return
     */
    @ApiOperation("根据hoscode depcode workDate查询科室详情")
    @GetMapping("/getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail(@PathVariable String hoscode,
                                    @PathVariable String depcode,
                                    @PathVariable String workDate){
        List<Schedule> result =  scheduleService.getScheduleDetail(hoscode,depcode,workDate);

        return Result.ok(result);
    }
}
